
import { Article } from "@/types/content/article";
import { get, post, put, remove } from "@/utils/request";


/**
 * 查询文章列表
 * @param data
 * @returns
 */
export const queryArticleList = (data: Article.Query & PageParams) => post<PageVo<Article.Row>>(`/article/list`, data,);
/**
 * 写文章
 * @param data
 * @returns
 */
export const addArticle = (data: Article.Row) => post<string>(`/article/add`, data);
/**
 * 更新文章
 * @param data
 * @returns
 */
export const updateArticle = (data: Article.Row) => put(`/article/update`, data);

/**
 * 删除文章
 * @param data
 * @returns
 */
export const deleteArticle = (data: IdsType) => remove(`/article/batchRemove`, data);

/**
 * 根据id获取文章详情
 * @param data
 * @returns
 */
export const queryArticleDetail = (id: string) => get<Article.Row>(`/article/${id}`);
/**
 * 文章下架
 * @param id
 * @returns
 */
export const changeArticleStatus = ( id: string,status: string) =>put(`/article/changeStatus?id=${id}&status=${status}`);
